package com.wc.acwing.思维.奶牛体检;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/2/22 21:29
 * @description
 * https://www.acwing.com/problem/content/6138/
 */
public class Main {
    /**
     * 思路：
     * 如果遍历左右边界的话
     * 反转后如何求, 左边可以用前缀和, 右边也可以用前缀和, 但是中间如果比较的话 时间复杂度会导致O(n^3)
     * 换种思路枚举, 枚举对称轴即可, 然后向两边扩展, 就可以利用前面的信息, 在 O(1)的时间复杂度计算出反转后的结果
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 7510;
    static int[] a = new int[N], b = new int[N], ans = new int[N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
        for (int i = 1; i <= n; i++) b[i] = sc.nextInt();
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            if (a[i] == b[i]) cnt ++;
        }

        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < 2; j++) {
                int sum = cnt;
                for (int l = i, r = i + j; l >= 1 && r <= n; l--, r++) {
                    // 去除原来的影响
                    if (a[l] == b[l]) sum--;
                    if (a[r] == b[r]) sum--;
                    // 记录现在的影响
                    if (a[l] == b[r]) sum++;
                    if (a[r] == b[l]) sum++;
                    ans[sum]++;
                }
            }
        }
        for (int i = 0; i <= n; i++) out.println(ans[i]);
        out.flush();
    }

}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

